package com.example.impl;

import com.example.mapper.WxbGoodSTypeMapper;
import com.example.model.WxbGoodType;
import com.example.model.vo.TypeVO;
import com.example.util.GoodTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class GoodTypeServiceImpl implements GoodTypeService {

    @Autowired
    private WxbGoodSTypeMapper wxbGoodSTypeMapper;

    public List<TypeVO> listTypes(){
        List<WxbGoodType> types = wxbGoodSTypeMapper.selectAll();
        List<TypeVO>typeVOS =new ArrayList<>();
        for(WxbGoodType type: types){
            typeVOS.add(new TypeVO(type));
        }
        return typeVOS;
    }
}
